﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>sample of onerror</title>
    <script type="text/javascript">
        // Display error messages in a dialog box, but never more than 3
        window.onerror = function (msg, url, line) {
            if (onerror.num++ < onerror.max) {
                alert("ERROR: " + msg + "\n" + url + ":" + line);
                return true;
            }
        };
        onerror.max = 3;
        onerror.num = 0;
    </script>
</head>
<body>
    <script type="text/javascript">
        var t = undefined;
        t.fool(5);
    </script>
</body>
</html>
